package com.qfmy.web.app.mapper.novel;

import com.qfmy.model.entity.novel.CommentReplies;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.web.app.mapper.novel
 * @date 2025/9/13
 * @description 评论回复表
 */
@Mapper
public interface CommentRepliesMapper {

    /**
     * 添加评论回复
     * @param commentReplies
     */
    void addCommentReplies(CommentReplies commentReplies);

    /**
     * 根据评论ID获取评论回复
     *
     * @param commentId
     * @param userId
     * @return
     */
    List<CommentReplies> getCommentRepliesByCommentId(Integer commentId, Long userId);

    /**
     * 删除评论回复
     * @param id
     */
    @Delete("delete from comment_replies where reply_id = #{id}")
    void deleteCommentReplies(Integer id);

    /**
     * 根据评论ID获取评论回复数
     * @param commentId
     * @param userId
     * @return
     */
    Integer selectCommentById(Integer commentId, Long userId);

    /**
     * 根据回复ID获取回复
     * @param replyId
     * @return
     */
    CommentReplies selectCommentReplyById(Integer replyId);
}
